if (typeof (mediator) == 'undefined')
	mediator = {};

if (typeof (mediator.studyingList) == 'undefined')
	mediator.studyingList = {};

mediator.studyingList.AppView = function(){
	var self = this;
	
	self.total = ko.observable(0);
	self.studies = ko.observableArray();
	
	return this;
};


mediator.studyingList.loadData = function(pid){
	return getPersonsStudies(pid);
}

mediator.studyingList.createViewMediator = function(options){
	
	var settings = $.extend({
		pid : 0,
		type : '',
		currentPage : 1, 
		pageSize : 1
	}, options || {});

	
	var appView = new mediator.studyingList.AppView();
	var data = mediator.studyingList.loadData(settings.pid)
	pushStudiesArray(data , appView.studies());
	mediator.studyingList.renderView();
	
	return appView;
}

mediator.studyingList.renderView = function(){
	$('#unStudy').attr('data-bind', 'if : studies().length == 0');
	$('#studies').attr('data-bind', 'foreach : studies()');
	$('#studyCourseName').attr('data-bind', 'text : course().name, click :redirectToStudied ');
	$('#studyCourseTagV').attr('data-bind', 'visible : course().tag');
	$('#studyCourseTag').attr('data-bind', 'text : course().tag');
	$('#studyCourseDescription').attr('data-bind', 'text : course().description');
	
};
